#{extends 'content.html' /}
#{set title: '我的微博' /}
#{set mypost :'active' /}
#{set user_name : usr.name /}
#{set user_img : usr.avatar/}
#{set user_post_cnt : usr.postCnt/}
#{set user_followers_cnt : usr.followersCnt/}
#{set user_following_cnt : usr.followingCnt/}
<br>
<h2>我发布了#{get 'user_post_cnt'/}条微博</h2>
<hr>
<div>
    #{list items: usr.getMBlog(), as: 'post'}
    <div id="div${post.id}">
        <img src="${post.author.avatar}" style="width: 50px;height: 50px" >        
        <br>
        <!-- 微博内容 -->
        <div style="position: relative;left: 60px;top:-35px; width: 440px" >
            <p style=" float: left; color: #008aff">${post.author.name}：</p>
            ${post.content}
            <br>
            <br>
            #{if post.image!=null}
            <img style="height:100px;cursor:pointer" class="postImg" src="${post.image}">
            <br>
            #{/if}
            <!--转发的微博 -->
            #{if post.originId!=0}
            <div class="alert alert-info" style="position: relative;left: 0px;top:5px; width: 420px">
                <p style=" float: left; color: #008aff">@${models.MBlog.findById(post.originId).author.name}:</p>
                ${models.MBlog.findById(post.originId).content}
                #{if models.MBlog.findById(post.originId).image!=null}
                <br>
                <br>
                <img style="height:100px;cursor:pointer" class="postImg" src="${models.MBlog.findById(post.originId).image}">
                <br>
                #{/if}            
                <p style="color: #008aff">${models.MBlog.findById(post.originId).createAt}</p>
            </div>
            #{/if}
            <br>
            <p style="color: #008aff">${post.createAt}</p>
        </div>
        <div  style=" position: relative;left: 420px;top:-62px">
            |&nbsp;
            <a style=" position: relative;left: 0px;top:1px" data-postid="${post.id}" data-toggle="modal" href="#modalbackdroptrue"  >
                转发(${post.forwardCnt})
            </a>
            #{if post.author.equals(usr)}
            |
            <a style=" position: relative;left: 0px;top:1px" class="del" data-mypostsid="${post.id}" onclick="$.get('@{Application.deleteMBlog(post.id)}') " href="#" >
                删除
            </a>
            #{/if}           
        </div>
        <!-- 评论 -->
        <div class="accordion" id="accordion2">
            <div class="accordion-heading">
                <a id="comText${post.id}" style=" position: relative;left: 358px;top:-87px; width: 48px"   class="accordion-toggle" data-toggle="collapse" data-loaded="0" data-parent="#accordion2" data-postid="${post.id}" href="#${post.id}">
                    评论(${post.commentCnt})
                </a>
                <div style="width: 470px; position: relative;left: 60px;top:-82px" id="${post.id}" class="accordion-body collapse">
                    <div class="accordion-inner   alert alert-info">
                        <form name="comment">
                            <input style="width: 375px;" type="text" class="span6" placeholder="请输入评论...">
                            <input style="position: relative;top:-5px" type="button" class="btn" value="评论"  data-postid="${post.id}" data-authorid="${post.author.id}">
                        </form>  
                        <div id="com${post.id}">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <hr>
    #{/list}
</div>


